<!doctype html>
<html>
<head>
    <!--Setting-->
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta name="apple-mobile-web-app-capable"  content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="format-detection" content="telephone=no,email=no">
    
    
    <!--Simple SEO-->


<meta name="robots" content=all />
<meta name="google" content=all />
<meta name="googlebot" content=all />
<meta name="verify" content=all />
    <!--Title-->

<title>docker企业级开源仓库harbor | MIAbon&#39;s blog</title>

<link rel="alternate" href="/atom.xml" title="MIAbon&#39;s blog" type="application/atom+xml">


<link rel="icon" href="/favicon.ico">

    
<link rel="stylesheet" href="/css/base.css">
<link rel="stylesheet" href="/css/pages/post.css">
<link rel="stylesheet" href="//cdn.bootcss.com/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="/css/thirdParty/highlight/github.css">
<link rel="stylesheet" href="/.css">

    <!--script-->


<script src="http://cdn1.lncld.net/static/js/3.2.1/av-min.js"></script>
<script>
  var appId = "i7AHmC7NPbPtgS3YxT67dRIc-9Nh9j0Va";
  var appKey = "g6TKbY8O4TsCDMcemoC3STvQ";
  var region = "";
  AV.init({
    appId: appId,
    appKey: appKey,
    region: region
  });
</script>


<script async src="//dn-lbstatics.qbox.me/busuanzi/2.3/busuanzi.pure.mini.js"></script>

<!--<script src="https://imsun.github.io/gitment/dist/gitment.browser.js"></script>-->


    
    
</head>

<body id="normal">
<!--[if lte IE 8]>
<style>
    html{ font-size: 1em }
</style>
<![endif]-->
<!--[if lte IE 9]>
<style>
    header{ top: 71px; position: absolute!important;}
    #container{padding-top: 151px!important;}
</style>
<div style="position:fixed;z-index:9999;left:0;top:0;width:100%;height:70px;background-color:#e0e0e0;color:#396CA5;border-bottom:1px solid #cecece;text-align:center;line-height:70px;white-space: nowrap;overflow: hidden;text-overflow: ellipsis">你使用的浏览器版本过低，为了你更好的阅读体验，请更新浏览器的版本或者使用其他现代浏览器，比如Chrome、Firefox、Safari等。</div>
<![endif]-->

<div id="wrap">
    <header  style="position: absolute;" >
    <div id="site-meta">
        <a href="/" id="logo">
            <h1 class="title">MIAbon&#39;s blog</h1>
        </a>
        
    </div>
    <ul id="nav">
        
            <li><a href="/"><i class="fa fa-home"></i>首页</a></li>
        
            <li><a href="/atom.xml"><i class="fa fa-rss"></i>RSS</a></li>
        
        <li id="search"><a href="javascript:void(0)"><i class="fa fa-search"></i>搜索</a></li>
    </ul>
</header>

    <div id="container">
        
<ul id="sidebar">
    
    
    
    
<li class="widget widget-normal category">
    <h3 class="fa fa-th widget-title">分类</h3>
    <ul class="category-list"><li class="category-list-item"><a class="category-list-link" href="/categories/ELK/"><i class="fa" aria-hidden="true">ELK</i></a><span class="category-list-count">1</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/Lvs/"><i class="fa" aria-hidden="true">Lvs</i></a><span class="category-list-count">2</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/admin/"><i class="fa" aria-hidden="true">admin</i></a><span class="category-list-count">5</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/ansible/"><i class="fa" aria-hidden="true">ansible</i></a><span class="category-list-count">1</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/aws/"><i class="fa" aria-hidden="true">aws</i></a><span class="category-list-count">1</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/docker/"><i class="fa" aria-hidden="true">docker</i></a><span class="category-list-count">7</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/drone/"><i class="fa" aria-hidden="true">drone</i></a><span class="category-list-count">1</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/kernel/"><i class="fa" aria-hidden="true">kernel</i></a><span class="category-list-count">2</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/kubernetes/"><i class="fa" aria-hidden="true">kubernetes</i></a><span class="category-list-count">2</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/kvm/"><i class="fa" aria-hidden="true">kvm</i></a><span class="category-list-count">1</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/mongodb/"><i class="fa" aria-hidden="true">mongodb</i></a><span class="category-list-count">1</span></li><li class="category-list-item"><a class="category-list-link current" href="/categories/python/"><i class="fa" aria-hidden="true">python</i></a><span class="category-list-count">9</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/share/"><i class="fa" aria-hidden="true">share</i></a><span class="category-list-count">1</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/web/"><i class="fa" aria-hidden="true">web</i></a><span class="category-list-count">12</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/zabbix/"><i class="fa" aria-hidden="true">zabbix</i></a><span class="category-list-count">3</span></li></ul>
</li>


    
    
<li class="widget widget-normal archive">
  <h3 class="fa fa-archive widget-title">归档</h3>
    <ul class="archive-list"><li class="archive-list-item"><a class="archive-list-link" href="/archives/2018/02/"><i class="fa" aria-hidden="true">二月 2018</i></a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2018/01/"><i class="fa" aria-hidden="true">一月 2018</i></a><span class="archive-list-count">8</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2017/12/"><i class="fa" aria-hidden="true">十二月 2017</i></a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2017/11/"><i class="fa" aria-hidden="true">十一月 2017</i></a><span class="archive-list-count">3</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2017/10/"><i class="fa" aria-hidden="true">十月 2017</i></a><span class="archive-list-count">4</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2017/09/"><i class="fa" aria-hidden="true">九月 2017</i></a><span class="archive-list-count">2</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2017/08/"><i class="fa" aria-hidden="true">八月 2017</i></a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2017/05/"><i class="fa" aria-hidden="true">五月 2017</i></a><span class="archive-list-count">4</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2017/04/"><i class="fa" aria-hidden="true">四月 2017</i></a><span class="archive-list-count">2</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2017/03/"><i class="fa" aria-hidden="true">三月 2017</i></a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2017/01/"><i class="fa" aria-hidden="true">一月 2017</i></a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/12/"><i class="fa" aria-hidden="true">十二月 2016</i></a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/11/"><i class="fa" aria-hidden="true">十一月 2016</i></a><span class="archive-list-count">3</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/10/"><i class="fa" aria-hidden="true">十月 2016</i></a><span class="archive-list-count">2</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/08/"><i class="fa" aria-hidden="true">八月 2016</i></a><span class="archive-list-count">2</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/05/"><i class="fa" aria-hidden="true">五月 2016</i></a><span class="archive-list-count">4</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/04/"><i class="fa" aria-hidden="true">四月 2016</i></a><span class="archive-list-count">8</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/05/"><i class="fa" aria-hidden="true">五月 2015</i></a><span class="archive-list-count">1</span></li></ul>
</li>


    
    
<li class="widget widget-normal tags">
  <h3 class="fa fa-tags widget-title">标签云</h3>
  <div class="tagcloud-content">
    
      <a href="/tags/drone/" style="font-size: 0.14rem; color: #69c">drone</a> <a href="/tags/linux/" style="font-size: 0.2rem; color: #0a407c">linux</a> <a href="/tags/kernel/" style="font-size: 0.16rem; color: #4f83b8">kernel</a> <a href="/tags/ELK/" style="font-size: 0.14rem; color: #69c">ELK</a> <a href="/tags/ansible/" style="font-size: 0.14rem; color: #69c">ansible</a> <a href="/tags/swarm/" style="font-size: 0.14rem; color: #69c">swarm</a> <a href="/tags/docker/" style="font-size: 0.18rem; color: #215690">docker</a> <a href="/tags/firewalld/" style="font-size: 0.14rem; color: #69c">firewalld</a> <a href="/tags/zabbix/" style="font-size: 0.16rem; color: #4f83b8">zabbix</a> <a href="/tags/aws/" style="font-size: 0.14rem; color: #69c">aws</a> <a href="/tags/web/" style="font-size: 0.16rem; color: #4f83b8">web</a> <a href="/tags/python/" style="font-size: 0.18rem; color: #215690">python</a> <a href="/tags/spider/" style="font-size: 0.17rem; color: #386da4">spider</a>
  </div>
</li>


    
    
<li class="widget widget-normal friends-link">
    <h3 class="fa fa-globe widget-title">友链</h3><br/>

    
        <a href="http://zhengwei666.wang" class="fa" target="_blank">zhengwei</a>

    
        <a href="https://you-deng.github.io" class="fa" target="_blank">dengyou</a>

    
        <a href="http://www.systemd.cn" class="fa" target="_blank">langyaoliang</a>

    
        <a href="http://www.chen-hao.com.cn/" class="fa" target="_blank">chenhao</a>

    
        <a href="http://www.yulongjun.com" class="fa" target="_blank">yulongjun</a>

    

</li>

    
</ul>


        <div id="main">
    <article id="post">
        <div id="post-header">

            <h1 id="docker企业级开源仓库harbor">
                
                docker企业级开源仓库harbor
                
            </h1>
            <div class="article-meta">
    
    
    <span class="categories-meta fa-wrap">
            <i class="fa fa-folder-open-o"></i>
        <span>docker</span>
    </span>
    
    
    <span class="fa-wrap">
         <i class="fa fa-tags"></i>
        <span class="tags-meta">
            
            linux
            
        </span>
    </span>
    
    
    <span class="fa-wrap">
        <i class="fa fa-clock-o"></i>
        <span class="date-meta ">2017/10/31</span>
    </span>
    
    
    <span class="fa-wrap">
            <i class="fa fa-thermometer-three-quarters"></i>
        <span class="hits hits-meta " data-leadcloud-title="docker企业级开源仓库harbor"
              data-leadcloud-url="/2017/10/31/harbor/"><i class="fa fa-spinner fa-spin"></i></span>
    </span>
    
    
</div>

            
            
        </div>
        
        <div id="post-body">
            <h1 id="准备工作"><a href="#准备工作" class="headerlink" title="准备工作"></a>准备工作</h1><h2 id="下载1-1-2离线安装包"><a href="#下载1-1-2离线安装包" class="headerlink" title="下载1.1.2离线安装包"></a>下载1.1.2离线安装包</h2><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">wget https://github.com/vmware/harbor/releases/download/v1.1.2/harbor-offline-installer-v1.1.2.tgz</div></pre></td></tr></table></figure>
<h2 id="解压到-usr-local"><a href="#解压到-usr-local" class="headerlink" title="解压到/usr/local"></a>解压到/usr/local</h2><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">tar vxf /harbor-offline-installer-v1.1.2.tgz -C /usr/<span class="built_in">local</span></div></pre></td></tr></table></figure>
<h2 id="需要用到docker-compose-没安装的需要安装"><a href="#需要用到docker-compose-没安装的需要安装" class="headerlink" title="需要用到docker-compose,没安装的需要安装"></a>需要用到docker-compose,没安装的需要安装</h2><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">yum install -y python2-pip-8.1.2-5.el7.noarch</div><div class="line">pip install docker-compose</div></pre></td></tr></table></figure>
<h2 id="创建ssl证书"><a href="#创建ssl证书" class="headerlink" title="创建ssl证书"></a>创建ssl证书</h2><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre></pre></td></tr></table></figure>
<h2 id="内网部署还需要建立dns解析"><a href="#内网部署还需要建立dns解析" class="headerlink" title="内网部署还需要建立dns解析"></a>内网部署还需要建立dns解析</h2><h1 id="修改-usr-local-harbor-harbor-cfg"><a href="#修改-usr-local-harbor-harbor-cfg" class="headerlink" title="修改/usr/local/harbor/harbor.cfg"></a>修改/usr/local/harbor/harbor.cfg</h1><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div><div class="line">24</div><div class="line">25</div><div class="line">26</div><div class="line">27</div><div class="line">28</div><div class="line">29</div><div class="line">30</div><div class="line">31</div><div class="line">32</div><div class="line">33</div><div class="line">34</div><div class="line">35</div><div class="line">36</div><div class="line">37</div><div class="line">38</div><div class="line">39</div><div class="line">40</div><div class="line">41</div><div class="line">42</div><div class="line">43</div><div class="line">44</div><div class="line">45</div><div class="line">46</div><div class="line">47</div><div class="line">48</div><div class="line">49</div><div class="line">50</div><div class="line">51</div><div class="line">52</div><div class="line">53</div><div class="line">54</div><div class="line">55</div><div class="line">56</div><div class="line">57</div><div class="line">58</div><div class="line">59</div><div class="line">60</div><div class="line">61</div><div class="line">62</div><div class="line">63</div><div class="line">64</div><div class="line">65</div><div class="line">66</div><div class="line">67</div><div class="line">68</div><div class="line">69</div><div class="line">70</div><div class="line">71</div><div class="line">72</div><div class="line">73</div><div class="line">74</div><div class="line">75</div><div class="line">76</div><div class="line">77</div><div class="line">78</div><div class="line">79</div><div class="line">80</div><div class="line">81</div><div class="line">82</div><div class="line">83</div><div class="line">84</div><div class="line">85</div><div class="line">86</div><div class="line">87</div><div class="line">88</div><div class="line">89</div><div class="line">90</div><div class="line">91</div><div class="line">92</div><div class="line">93</div><div class="line">94</div><div class="line">95</div><div class="line">96</div><div class="line">97</div><div class="line">98</div><div class="line">99</div><div class="line">100</div><div class="line">101</div><div class="line">102</div><div class="line">103</div><div class="line">104</div><div class="line">105</div><div class="line">106</div></pre></td><td class="code"><pre><div class="line"><span class="comment">## Configuration file of Harbor</span></div><div class="line"><span class="comment">#The IP address or hostname to access admin UI and registry service.</span></div><div class="line"><span class="comment">#DO NOT use localhost or 127.0.0.1, because Harbor needs to be accessed by external clients.</span></div><div class="line"><span class="comment">#需要填写你的域名</span></div><div class="line">hostname = www.domain.com</div><div class="line"><span class="comment">#The protocol for accessing the UI and token/notification service, by default it is http.</span></div><div class="line"><span class="comment">#It can be set to https if ssl is enabled on nginx.</span></div><div class="line"><span class="comment">#需要修改url的认证方式http或者https,因为registry仓库V2版本是采用https，所以还需要配置ssl</span></div><div class="line">ui_url_protocol = https</div><div class="line"><span class="comment">#The password for the root user of mysql db, change this before any production use.</span></div><div class="line"><span class="comment">#数据库密码</span></div><div class="line">db_password = root123</div><div class="line"><span class="comment">#Maximum number of job workers in job service  </span></div><div class="line">max_job_workers = 3 </div><div class="line"><span class="comment">#Determine whether or not to generate certificate for the registry's token.</span></div><div class="line"><span class="comment">#If the value is on, the prepare script creates new root cert and private key </span></div><div class="line"><span class="comment">#for generating token to access the registry. If the value is off the default key/cert will be used.</span></div><div class="line"><span class="comment">#This flag also controls the creation of the notary signer's cert.</span></div><div class="line">customize_crt = on</div><div class="line"><span class="comment">#The path of cert and key files for nginx, they are applied only the protocol is set to https</span></div><div class="line"><span class="comment">#这两个参数会传进nginx配置文件作为https的证书认证</span></div><div class="line">ssl_cert = /data/cert/dr.tt.com.crt</div><div class="line">ssl_cert_key = /data/cert/dr.tt.com.key</div><div class="line"><span class="comment">#The path of secretkey storage</span></div><div class="line">secretkey_path = /data</div><div class="line"><span class="comment">#Admiral's url, comment this attribute, or set its value to NA when Harbor is standalone</span></div><div class="line">admiral_url = NA</div><div class="line"><span class="comment">#NOTES: The properties between BEGIN INITIAL PROPERTIES and END INITIAL PROPERTIES</span></div><div class="line"><span class="comment">#only take effect in the first boot, the subsequent changes of these properties </span></div><div class="line"><span class="comment">#should be performed on web ui</span></div><div class="line"><span class="comment">#************************BEGIN INITIAL PROPERTIES************************</span></div><div class="line"><span class="comment">#Email account settings for sending out password resetting emails.</span></div><div class="line"><span class="comment">#Email server uses the given username and password to authenticate on TLS connections to host and act as identity.</span></div><div class="line"><span class="comment">#Identity left blank to act as username.</span></div><div class="line">email_identity = </div><div class="line">email_server = smtp.mydomain.com</div><div class="line">email_server_port = 25</div><div class="line">email_username = sample_admin@mydomain.com</div><div class="line">email_password = abc</div><div class="line">email_from = admin &lt;sample_admin@mydomain.com&gt;</div><div class="line">email_ssl = <span class="literal">false</span></div><div class="line"><span class="comment">##The initial password of Harbor admin, only works for the first time when Harbor starts. </span></div><div class="line"><span class="comment">#It has no effect after the first launch of Harbor.</span></div><div class="line"><span class="comment">#Change the admin password from UI after launching Harbor.</span></div><div class="line"><span class="comment">#harbor默认用户名admin，下面可以设置初始密码</span></div><div class="line">harbor_admin_password = Harbor12345</div><div class="line"><span class="comment">##By default the auth mode is db_auth, i.e. the credentials are stored in a local database.</span></div><div class="line"><span class="comment">#Set it to ldap_auth if you want to verify a user's credentials against an LDAP server.</span></div><div class="line">auth_mode = db_auth</div><div class="line"><span class="comment">#The url for an ldap endpoint.</span></div><div class="line">ldap_url = ldaps://ldap.mydomain.com</div><div class="line"><span class="comment">#A user's DN who has the permission to search the LDAP/AD server. </span></div><div class="line"><span class="comment">#If your LDAP/AD server does not support anonymous search, you should configure this DN and ldap_search_pwd.</span></div><div class="line"><span class="comment">#ldap_searchdn = uid=searchuser,ou=people,dc=mydomain,dc=com</span></div><div class="line"><span class="comment">#the password of the ldap_searchdn</span></div><div class="line"><span class="comment">#ldap_search_pwd = password</span></div><div class="line"><span class="comment">#The base DN from which to look up a user in LDAP/AD</span></div><div class="line">ldap_basedn = ou=people,dc=mydomain,dc=com</div><div class="line"><span class="comment">#Search filter for LDAP/AD, make sure the syntax of the filter is correct.</span></div><div class="line"><span class="comment">#ldap_filter = (objectClass=person)</span></div><div class="line"><span class="comment"># The attribute used in a search to match a user, it could be uid, cn, email, sAMAccountName or other attributes depending on your LDAP/AD  </span></div><div class="line">ldap_uid = uid </div><div class="line"><span class="comment">#the scope to search for users, 1-LDAP_SCOPE_BASE, 2-LDAP_SCOPE_ONELEVEL, 3-LDAP_SCOPE_SUBTREE</span></div><div class="line">ldap_scope = 3 </div><div class="line"><span class="comment">#Timeout (in seconds)  when connecting to an LDAP Server. The default value (and most reasonable) is 5 seconds.</span></div><div class="line">ldap_timeout = 5</div><div class="line"><span class="comment">#Turn on or off the self-registration feature</span></div><div class="line">self_registration = on</div><div class="line"><span class="comment">#The expiration time (in minute) of token created by token service, default is 30 minutes</span></div><div class="line">token_expiration = 30</div><div class="line"><span class="comment">#The flag to control what users have permission to create projects</span></div><div class="line"><span class="comment">#The default value "everyone" allows everyone to creates a project. </span></div><div class="line"><span class="comment">#Set to "adminonly" so that only admin user can create project.</span></div><div class="line">project_creation_restriction = everyone</div><div class="line"><span class="comment">#Determine whether the job service should verify the ssl cert when it connects to a remote registry.</span></div><div class="line"><span class="comment">#Set this flag to off when the remote registry uses a self-signed or untrusted certificate.</span></div><div class="line">verify_remote_cert = on</div><div class="line"><span class="comment">#************************END INITIAL PROPERTIES************************</span></div><div class="line"><span class="comment">#############</span></div></pre></td></tr></table></figure>
<h2 id="修改编排文件-usr-local-harbor-docker-compose-yml"><a href="#修改编排文件-usr-local-harbor-docker-compose-yml" class="headerlink" title="修改编排文件/usr/local/harbor/docker-compose.yml"></a>修改编排文件/usr/local/harbor/docker-compose.yml</h2><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div><div class="line">24</div><div class="line">25</div><div class="line">26</div><div class="line">27</div><div class="line">28</div><div class="line">29</div><div class="line">30</div><div class="line">31</div><div class="line">32</div><div class="line">33</div><div class="line">34</div><div class="line">35</div><div class="line">36</div><div class="line">37</div><div class="line">38</div><div class="line">39</div><div class="line">40</div><div class="line">41</div><div class="line">42</div><div class="line">43</div><div class="line">44</div><div class="line">45</div><div class="line">46</div><div class="line">47</div><div class="line">48</div><div class="line">49</div><div class="line">50</div><div class="line">51</div><div class="line">52</div><div class="line">53</div><div class="line">54</div><div class="line">55</div><div class="line">56</div><div class="line">57</div><div class="line">58</div><div class="line">59</div><div class="line">60</div><div class="line">61</div><div class="line">62</div><div class="line">63</div><div class="line">64</div><div class="line">65</div><div class="line">66</div><div class="line">67</div><div class="line">68</div><div class="line">69</div><div class="line">70</div><div class="line">71</div><div class="line">72</div><div class="line">73</div><div class="line">74</div><div class="line">75</div><div class="line">76</div><div class="line">77</div><div class="line">78</div><div class="line">79</div><div class="line">80</div><div class="line">81</div><div class="line">82</div><div class="line">83</div><div class="line">84</div><div class="line">85</div><div class="line">86</div><div class="line">87</div><div class="line">88</div><div class="line">89</div><div class="line">90</div><div class="line">91</div><div class="line">92</div><div class="line">93</div><div class="line">94</div><div class="line">95</div><div class="line">96</div><div class="line">97</div><div class="line">98</div><div class="line">99</div><div class="line">100</div><div class="line">101</div><div class="line">102</div><div class="line">103</div><div class="line">104</div><div class="line">105</div><div class="line">106</div><div class="line">107</div><div class="line">108</div><div class="line">109</div><div class="line">110</div><div class="line">111</div><div class="line">112</div><div class="line">113</div><div class="line">114</div><div class="line">115</div><div class="line">116</div><div class="line">117</div><div class="line">118</div><div class="line">119</div><div class="line">120</div><div class="line">121</div><div class="line">122</div><div class="line">123</div><div class="line">124</div><div class="line">125</div><div class="line">126</div><div class="line">127</div><div class="line">128</div><div class="line">129</div><div class="line">130</div><div class="line">131</div><div class="line">132</div><div class="line">133</div><div class="line">134</div><div class="line">135</div></pre></td><td class="code"><pre><div class="line">version: <span class="string">'2'</span></div><div class="line">services:</div><div class="line">  <span class="built_in">log</span>:</div><div class="line">    image: vmware/harbor-log:v1.1.2</div><div class="line">    container_name: harbor-log </div><div class="line">    restart: always</div><div class="line">    volumes:</div><div class="line">      - /var/<span class="built_in">log</span>/harbor/:/var/<span class="built_in">log</span>/docker/:z</div><div class="line">    ports:</div><div class="line">      - 127.0.0.1:1514:514</div><div class="line">    networks:</div><div class="line">      - harbor</div><div class="line">  registry:</div><div class="line">    image: vmware/registry:2.6.1-photon</div><div class="line">    container_name: registryv2 <span class="comment">#如果当前主机有registry命名的容器仓库，需要重命名</span></div><div class="line">    restart: always</div><div class="line">    volumes:</div><div class="line">      - /data/registry:/storage:z</div><div class="line">      - ./common/config/registry/:/etc/registry/:z</div><div class="line">    networks:</div><div class="line">      - harbor</div><div class="line">    environment:</div><div class="line">      - GODEBUG=netdns=cgo</div><div class="line">    <span class="built_in">command</span>:</div><div class="line">      [<span class="string">"serve"</span>, <span class="string">"/etc/registry/config.yml"</span>]</div><div class="line">    depends_on:</div><div class="line">      - <span class="built_in">log</span></div><div class="line">    logging:</div><div class="line">      driver: <span class="string">"syslog"</span></div><div class="line">      options:  </div><div class="line">        syslog-address: <span class="string">"tcp://127.0.0.1:1514"</span></div><div class="line">        tag: <span class="string">"registry"</span></div><div class="line">  mysql:</div><div class="line">    image: vmware/harbor-db:v1.1.2</div><div class="line">    container_name: harbor-db</div><div class="line">    restart: always</div><div class="line">    volumes:</div><div class="line">      - /data/database:/var/lib/mysql:z</div><div class="line">    networks:</div><div class="line">      - harbor</div><div class="line">    env_file:</div><div class="line">      - ./common/config/db/env</div><div class="line">    depends_on:</div><div class="line">      - <span class="built_in">log</span></div><div class="line">    logging:</div><div class="line">      driver: <span class="string">"syslog"</span></div><div class="line">      options:  </div><div class="line">        syslog-address: <span class="string">"tcp://127.0.0.1:1514"</span></div><div class="line">        tag: <span class="string">"mysql"</span></div><div class="line">  adminserver:</div><div class="line">    image: vmware/harbor-adminserver:v1.1.2</div><div class="line">    container_name: harbor-adminserver</div><div class="line">    env_file:</div><div class="line">      - ./common/config/adminserver/env</div><div class="line">    restart: always</div><div class="line">    volumes:</div><div class="line">      - /data/config/:/etc/adminserver/config/:z</div><div class="line">      - /data/secretkey:/etc/adminserver/key:z</div><div class="line">      - /data/:/data/:z</div><div class="line">    networks:</div><div class="line">      - harbor</div><div class="line">    depends_on:</div><div class="line">      - <span class="built_in">log</span></div><div class="line">    logging:</div><div class="line">      driver: <span class="string">"syslog"</span></div><div class="line">      options:  </div><div class="line">        syslog-address: <span class="string">"tcp://127.0.0.1:1514"</span></div><div class="line">        tag: <span class="string">"adminserver"</span></div><div class="line">  ui:</div><div class="line">    image: vmware/harbor-ui:v1.1.2</div><div class="line">    container_name: harbor-ui</div><div class="line">    env_file:</div><div class="line">      - ./common/config/ui/env</div><div class="line">    restart: always</div><div class="line">    volumes:</div><div class="line">      - ./common/config/ui/app.conf:/etc/ui/app.conf:z</div><div class="line">      - ./common/config/ui/private_key.pem:/etc/ui/private_key.pem:z</div><div class="line">      - /data/secretkey:/etc/ui/key:z</div><div class="line">      - /data/ca_download/:/etc/ui/ca/:z</div><div class="line">    networks:</div><div class="line">      - harbor</div><div class="line">    depends_on:</div><div class="line">      - <span class="built_in">log</span></div><div class="line">      - adminserver</div><div class="line">      - registry</div><div class="line">    logging:</div><div class="line">      driver: <span class="string">"syslog"</span></div><div class="line">      options:  </div><div class="line">        syslog-address: <span class="string">"tcp://127.0.0.1:1514"</span></div><div class="line">        tag: <span class="string">"ui"</span></div><div class="line">  jobservice:</div><div class="line">    image: vmware/harbor-jobservice:v1.1.2</div><div class="line">    container_name: harbor-jobservice</div><div class="line">    env_file:</div><div class="line">      - ./common/config/jobservice/env</div><div class="line">    restart: always</div><div class="line">    volumes:</div><div class="line">      - /data/job_logs:/var/<span class="built_in">log</span>/<span class="built_in">jobs</span>:z</div><div class="line">      - ./common/config/jobservice/app.conf:/etc/jobservice/app.conf:z</div><div class="line">      - /data/secretkey:/etc/jobservice/key:z</div><div class="line">    networks:</div><div class="line">      - harbor</div><div class="line">    depends_on:</div><div class="line">      - ui</div><div class="line">      - adminserver</div><div class="line">    logging:</div><div class="line">      driver: <span class="string">"syslog"</span></div><div class="line">      options:  </div><div class="line">        syslog-address: <span class="string">"tcp://127.0.0.1:1514"</span></div><div class="line">        tag: <span class="string">"jobservice"</span></div><div class="line">  proxy:</div><div class="line">    image: vmware/nginx:1.11.5-patched</div><div class="line">    container_name: nginx</div><div class="line">    restart: always</div><div class="line">    volumes:</div><div class="line">      - ./common/config/nginx:/etc/nginx:z</div><div class="line">    networks:</div><div class="line">      - harbor</div><div class="line">    ports:</div><div class="line">      - 8080:80 <span class="comment">#如果当前主机占用80端口，这里需要修改nginx的对外端口</span></div><div class="line">      - 443:443</div><div class="line">      - 4443:4443</div><div class="line">    depends_on:</div><div class="line">      - mysql</div><div class="line">      - registry</div><div class="line">      - ui</div><div class="line">      - <span class="built_in">log</span></div><div class="line">    logging:</div><div class="line">      driver: <span class="string">"syslog"</span></div><div class="line">      options:  </div><div class="line">        syslog-address: <span class="string">"tcp://127.0.0.1:1514"</span></div><div class="line">        tag: <span class="string">"proxy"</span></div><div class="line">networks:</div><div class="line">  harbor:</div><div class="line">    external: <span class="literal">false</span></div></pre></td></tr></table></figure>
<h1 id="安装harbor"><a href="#安装harbor" class="headerlink" title="安装harbor"></a>安装harbor</h1><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">./install.sh</div></pre></td></tr></table></figure>

        </div>
        <div id="post-footer">
            <div class="avatar" >
                <img src="/img/author.jpg" alt="avatar"/>
                <!-- 
                <a href="javascript:void(0)" class="high-song">high起来 &#128541;</a>
                 -->
                
                <a href="http://backup-miabon.oss-cn-hongkong.aliyuncs.com/img/alipay.jpg" target="_blank" class="donate fa">打赏小弟 &#128536;</a>
                
            </div>
            <ul class="author-profile-section">
                <li>
                  
                  作者:
                  
                    
                    <a href="/about.html">MIAbon</a>
                </li>
                
                <li>发表日期: <span>2017-10-31  00:00:00</span></li>
                
                <li>最后编辑日期: <span>2017-11-23  08:23:00</span></li>
                
                <li class="post-category">
                    文章分类:
                    
                    <a href="/categories/docker/">docker</a>
                    
                </li>
                <li class="post-tags">
                    文章标签:
                    
                    <a href="/tags/linux/">linux</a>
                    
                    <a href="/tags/docker/">docker</a>
                    
                </li>
                
                <li> 版权声明: <a href="https://creativecommons.org/licenses/by-nc-nd/3.0/" target="_blank">
知识共享署名-非商业性使用-禁止演绎 3.0 未本地化版本许可协议（CC BY-NC-ND 3.0）
</a></li>
                
            </ul>
            <div id="donate-wrap">
                
                
                
                <img src="http://www.geasslinks.com/img/alipay.jpg" alt="支付宝付款" class="donate-img">
                
                
            </div>
        </div>
    </article>
    <div class="article-nav">
        
        <a href="/2017/10/31/将blog自动化部署/" class="pre-post fa fa-caret-left">将blog自动化部署</a>
        
        
        <a href="/2017/10/30/drone_启动yaml示例/" class="next-post fa">drone 0.8版本以后启动yaml示例</a>
        
    </div>
    
    <div id="comments">
        

<script>
  gitment.render(document.getElementById("comments"));
</script>



    </div>
    
</div>


    </div>
    <footer id="footer">
    
    <div class="social">
        
        <a href="https://www.example1.com" class="fa fa-free-code-camp" target="_blank" title="freecodecamp"></a>
        
        <a href="https://github.com/werewolf2101" class="fa fa-github" target="_blank" title="Follow me~"></a>
        
        <a href="mailto:werewolf2101@gmail.com" class="fa fa-email" target="_blank" title="Email"></a>
        
    </div>
    
    <div>
        
        <a href="/" class="copyright-links">MIAbon</a>&copy;2015 - 2018.All Rights
        Reserved.
    </div>
    <p>Powered by <a href="https://hexo.io" class="copyright-links" target="_blank">Hexo</a> | Theme by <a
                href="https://github.com/GeekaholicLin" class="copyright-links" target="_blank">GeekaholicLin</a>
    </p>
    
    
    <p>
        <span id="busuanzi_container_site_uv" class="fa fa-bar-chart">
        欢迎第<span id="busuanzi_value_site_uv"><i class="fa fa-spinner fa-spin"></i></span>位小伙伴~
        </span>
    </p>
    
</footer>

</div>
    <ul id="tools">
    <li class="totop-btn fa fa-angle-up"></li>
    <li class="exchange-btn fa fa-exchange"></li>
  
    <li class="toc-btn fa fa-list-ul"></li>
    
    

    
</ul>
<p id="process"></p>
<div id="search-overlay">
    <div class="search-area-wrap">
        <div id="search-area">
            <div class="input-wrap focus">
                <i class="fa fa-search" aria-hidden="true"></i>
                <input id="search-input" autofocus autocomplete="off" type="text"
                       placeholder="search this website..."/>
            </div>
            <ul id="search-result">
                <li class="load-first"><i class="fa fa-spinner fa-pulse"></i></li>
            </ul>
        </div>
    </div>
</div>

    <ol class="toc"><li class="toc-item toc-level-1"><a class="toc-link" href="#准备工作"><span class="toc-number">1.</span> <span class="toc-text">准备工作</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#下载1-1-2离线安装包"><span class="toc-number">1.1.</span> <span class="toc-text">下载1.1.2离线安装包</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#解压到-usr-local"><span class="toc-number">1.2.</span> <span class="toc-text">解压到/usr/local</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#需要用到docker-compose-没安装的需要安装"><span class="toc-number">1.3.</span> <span class="toc-text">需要用到docker-compose,没安装的需要安装</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#创建ssl证书"><span class="toc-number">1.4.</span> <span class="toc-text">创建ssl证书</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#内网部署还需要建立dns解析"><span class="toc-number">1.5.</span> <span class="toc-text">内网部署还需要建立dns解析</span></a></li></ol></li><li class="toc-item toc-level-1"><a class="toc-link" href="#修改-usr-local-harbor-harbor-cfg"><span class="toc-number">2.</span> <span class="toc-text">修改/usr/local/harbor/harbor.cfg</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#修改编排文件-usr-local-harbor-docker-compose-yml"><span class="toc-number">2.1.</span> <span class="toc-text">修改编排文件/usr/local/harbor/docker-compose.yml</span></a></li></ol></li><li class="toc-item toc-level-1"><a class="toc-link" href="#安装harbor"><span class="toc-number">3.</span> <span class="toc-text">安装harbor</span></a></li></ol>


    <script src="/js/highsong.js"></script>



<script src="/js/search.js"></script>
<script type="text/javascript">
    //theme config datas
    var copyrightObj = {};
    copyrightObj.enable = 'true';
    copyrightObj.triggerCopyLength = '200';
    copyrightObj.appendText = '商业转载请联系作者获得授权,非商业转载请注明出处 © gasslinks.com';
    var leancloudObj = {};
    leancloudObj.enable = 'true';
    leancloudObj.className = 'blog';
    leancloudObj.limits = '5';
</script>
<script>
var _hmt = _hmt || [];
(function() {
  var hm = document.createElement("script");
  hm.src = "https://hm.baidu.com/hm.js?dfebe5842f5d4196471b84802392a4b2";
  var s = document.getElementsByTagName("script")[0]; 
  s.parentNode.insertBefore(hm, s);
})();
</script>
<script type="text/javascript">
    var search = {};
    var search_path = "search.xml";
    if (!search_path) {
        search_path = "search.xml";
    }
    search.path = "/" + search_path;
    search.func =  _ajax.init();
</script>
<script src="/js/app.js"></script>


</body>
</html>